import Vue from "vue";
export default class common extends Vue {
  /**
   * 防抖函数
   * @param {
   *  function
   * }
   * @returns {
   *  function
   * }
   */
  static debounce(fn, delay = 400) {
    let timeout = null;
    return function() {
      const context = this;
      const args = arguments;
      clearTimeout(timeout);
      timeout = setTimeout(() => {
        fn.apply(context, args);
      }, delay);
    };
  }
}
